package main

import (
	"fmt"
	"ops.alert.center.service/internal/middleware"
	"ops.alert.center.service/internal/router"
	"ops.alert.center.service/internal/util"
	"time"
)

func main() {
	ticker := time.NewTicker(time.Second * 5)
	middleware.InitLogger(middleware.LogPath, "debug")
	//获取nacos的配置
	fmt.Println(middleware.UserName, middleware.DbName, middleware.Ip, middleware.Port, middleware.Password)
	fmt.Println(middleware.WechatUserCorpid, middleware.WechatUserCorpSecret)
	//获取告警数据库的信息
	go middleware.GetZhaoapplicatinAllData()
	go middleware.GetalertcontactAllData()
	go middleware.GetAlertsubscriptionAllData()
	go middleware.GetAlertwaysAllData()

	//获取微信数据存至二叉树
	go util.GetWechatData()
	//开启redis
	go util.InitRedis()
	//并发消费redis
	go func() {
		for {
			select {
			case <-ticker.C:
				go util.GetRedisKeys()
			}
		}
	}()
	router.Init()

}
